/* Dystopian Analysis */

clear all
capture log close
set more off 
cd "C:\Users\Celia\Dropbox\Joint Projects\EffectsOfDystopianPopCultureStudy\Survey Data\"

*********************************************
* Cleaning and Combining All Three Datasets *
*********************************************
log using "log_dystopian_pop_results.txt", replace text
run "code\dystopian_pop_mtcleaning.do"
run "code\dystopian_pop_stu1cleaning.do"
run "code\dystopian_pop_stu2cleaning.do"
clear all

use "sourcedata\Clean_First3_Dystop.dta", clear
alpha j_damage j_cyber
alpha j_violent j_rebel

***********
* Table 1 *
***********
use "sourcedata\Clean_First3_Dystop.dta", clear
drop if mi(j_disobed) | mi(j_damage) | mi(j_cyber) | mi(j_rebel) | mi(j_violent) | mi(rel_violence) 

* Column 1:
ttest j_disobed if whichdata==1, by(hgindic)		
ttest j_semivio if whichdata==1, by(hgindic)
ttest j_realvio if whichdata==1, by(hgindic)
ttest rel_violence if whichdata==1, by(hgindic)

* Column 2:
ttest j_disobed if whichdata==1, by(divindic)		
ttest j_semivio if whichdata==1, by(divindic)
ttest j_realvio if whichdata==1, by(divindic)
ttest rel_violence if whichdata==1, by(divindic)

************
* Figure 1 *
************
* Figure 1 is graphic with words only.

************
* Figure 2 *
************
use "sourcedata\Clean_First3_Dystop.dta", clear
drop if mi(j_disobed) | mi(j_damage) | mi(j_cyber) | mi(j_rebel) | mi(j_violent) | mi(rel_violence) 

* First set of bars:
ttest j_disobed if whichdata==2, by(hgindic)	
ttest j_disobed if whichdata==2, by(ffbase)		

* Second set of bars:	
ttest j_semivio if whichdata==2, by(hgindic)
ttest j_semivio if whichdata==2, by(ffbase)

* Third set of bars:	
ttest j_realvio if whichdata==2, by(hgindic)
ttest j_realvio if whichdata==2, by(ffbase)

* Fourth set of bars:	
ttest rel_violence if whichdata==2, by(hgindic)
ttest rel_violence if whichdata==2, by(ffbase)

************
* Figure 3 *
************
use "sourcedata\Clean_First3_Dystop.dta", clear
drop if mi(j_disobed) | mi(j_damage) | mi(j_cyber) | mi(j_rebel) | mi(j_violent) | mi(rel_violence) 

* First set of bars:
ttest j_disobed if whichdata==3, by(hgindic)		
ttest j_disobed if whichdata==3, by(nfbase)	
	
* Second set of bars:		
ttest j_semivio if whichdata==3, by(hgindic)
ttest j_semivio if whichdata==3, by(nfbase)

* Third set of bars:	
ttest j_realvio if whichdata==3, by(hgindic)
ttest j_realvio if whichdata==3, by(nfbase)
ttest j_realvio if whichdata==3, by(twotreat)

* Fourth set of bars:	
ttest rel_violence if whichdata==3, by(hgindic)
ttest rel_violence if whichdata==3, by(nfbase)
ttest rel_violence if whichdata==3, by(twotreat)

************
* Figure 4 *
************
use "sourcedata\Clean_First3_Dystop.dta", clear
drop if mi(j_disobed) | mi(j_damage) | mi(j_cyber) | mi(j_rebel) | mi(j_violent) | mi(rel_violence) 

ttest j_disobed, by(hgindic)
ttest j_semivio, by(hgindic)		
ttest j_realvio, by(hgindic)		
ttest rel_violence, by(hgindic)		


***********
* Table 2 *
***********
use "sourcedata\Clean_First3_Dystop.dta", clear
drop if mi(i_power) | mi(i_free ) | mi(i_surveil) | mi(i_immig) | mi(i_police) | mi(i_ineq) | mi(i_health) | mi(i_climate) /* drops 80 observations over 3 studies */

* Column 1:
ttest i_power, by(hgindic)
ttest i_free, by(hgindic)
ttest i_surveil, by(hgindic)
ttest i_health, by(hgindic)
ttest i_police, by(hgindic)
ttest i_immig, by(hgindic)
ttest i_ineq, by(hgindic)
ttest i_climate, by(hgindic)

* Column 2:
ttest i_power if whichdata==1, by(hgindic)
ttest i_free if whichdata==1, by(hgindic)
ttest i_surveil if whichdata==1, by(hgindic)
ttest i_health if whichdata==1, by(hgindic)
ttest i_police if whichdata==1, by(hgindic)
ttest i_immig if whichdata==1, by(hgindic)
ttest i_ineq if whichdata==1, by(hgindic)
ttest i_climate if whichdata==1, by(hgindic)

* Column 3:
ttest i_power if whichdata==1, by(divindic)
ttest i_free if whichdata==1, by(divindic)
ttest i_surveil if whichdata==1, by(divindic)
ttest i_health if whichdata==1, by(divindic)
ttest i_police if whichdata==1, by(divindic)
ttest i_immig if whichdata==1, by(divindic)
ttest i_ineq if whichdata==1, by(divindic)
ttest i_climate if whichdata==1, by(divindic)

* Column 4:
ttest i_power if whichdata==2, by(hgindic)
ttest i_free if whichdata==2, by(hgindic)
ttest i_surveil if whichdata==2, by(hgindic)
ttest i_health if whichdata==2, by(hgindic)
ttest i_police if whichdata==2, by(hgindic)
ttest i_immig if whichdata==2, by(hgindic)
ttest i_ineq if whichdata==2, by(hgindic)
ttest i_climate if whichdata==2, by(hgindic)

* Column 5: 
ttest i_power if whichdata==3, by(hgindic)
ttest i_free if whichdata==3, by(hgindic)
ttest i_surveil if whichdata==3, by(hgindic)
ttest i_health if whichdata==3, by(hgindic)
ttest i_police if whichdata==3, by(hgindic)
ttest i_immig if whichdata==3, by(hgindic)
ttest i_ineq if whichdata==3, by(hgindic)
ttest i_climate if whichdata==3, by(hgindic)

* Column 6:
ttest i_power if whichdata==3, by(twotreat)
ttest i_free if whichdata==3, by(twotreat)
ttest i_surveil if whichdata==3, by(twotreat)
ttest i_health if whichdata==3, by(twotreat)
ttest i_police if whichdata==3, by(twotreat)
ttest i_immig if whichdata==3, by(twotreat)
ttest i_ineq if whichdata==3, by(twotreat)
ttest i_climate if whichdata==3, by(twotreat)


***********
* Table 3 *
***********
use "sourcedata\Clean_First3_Dystop.dta", clear
drop if mi(eff_petit) | mi(eff_letter) | mi(eff_socmed) | mi(eff_doncan) | mi(eff_donact) | mi(eff_vote) | ///
	mi(eff_nonvio) | mi(eff_cyber) | mi(eff_damage) | mi(eff_violent) | mi(eff_rebel) | mi(eff_overthrow)

* Table Notes:
alpha eff_petit eff_letter eff_socmed eff_doncan eff_donact eff_vote eff_nonvio /* .84 */
alpha eff_cyber eff_damage					/* .80 */
alpha eff_violent eff_rebel					/* .83 */
alpha eff_violent eff_rebel eff_overthrow	/* .86 */

* Column 1:
ttest eff_conven if whichdata==3 & correct_all==1, by(hgindic)
ttest eff_semivio if whichdata==3 & correct_all==1, by(hgindic)
ttest eff_realvio2 if whichdata==3 & correct_all==1, by(hgindic)
ttest eff_realvio3 if whichdata==3 & correct_all==1, by(hgindic)

* Column 2:
ttest eff_conven if whichdata==3 & correct_all==1, by(nfbase)
ttest eff_semivio if whichdata==3 & correct_all==1, by(nfbase)
ttest eff_realvio2 if whichdata==3 & correct_all==1, by(nfbase)
ttest eff_realvio3 if whichdata==3 & correct_all==1, by(nfbase)

* Column 3:
ttest eff_conven if whichdata==3 & correct_all==1, by(twotreat)
ttest eff_semivio if whichdata==3 & correct_all==1, by(twotreat)
ttest eff_realvio2 if whichdata==3 & correct_all==1, by(twotreat)
ttest eff_realvio3 if whichdata==3 & correct_all==1, by(twotreat)


***********
* Table 4 *
***********
use "sourcedata\Clean_First3_Dystop.dta", clear

* Column 1:
ttest ne_feels if whichdata==2, by(treatfeels)
ttest ne_immers if whichdata==2, by(treatfeels)
ttest ne_compre if whichdata==2, by(treatfeels)
ttest ne_focus if whichdata==2, by(treatfeels)

* Column 2:
ttest ne_feels if whichdata==3, by(treatfeels)
ttest ne_immers if whichdata==3, by(treatfeels)
ttest ne_compre if whichdata==3, by(treatfeels)
ttest ne_focus if whichdata==3, by(treatfeels)

log close
